package com.qfhd.soft.cjzcore.Model;


import com.qfhd.soft.cjzcore.Core.CJJsonUtils;

import org.json.JSONObject;

public class Task_image_item_model {
    //    "icon": "https://img.icons8.com/ios-filled/2x/ok-message.png",
//            "task_type": 1,
//            "reward": 300,
//            "total_num": 100,
//            "cost_num": 0,
//            "task_title": "钱叮叮",
//            "tid": "451fb8627391a962c267eb3a345e98fe"
//    @SerializedName("tid")
    public String id;

    public String icon;

//    @SerializedName("task_type")
    public int iconType;

//    @SerializedName("task_title")
    public String title;

//    @SerializedName("reward")
    public float money;

//    @SerializedName("total_num")
    public int totalCount;

//    @SerializedName("cost_num")
    public int doneCoount;

    public int ut_status;

    public String getStatus() {
        switch (ut_status) {
            case 0: {
//                return "提交";
                return "";
            }
            case 1: {
                return "审核中";
//                return "";
            }
            case 2: {
                return "已到账";
//                return "";
            }
            case 3: {
                return "提交(审核失败)";
//                return "";
            }
            default: {
                return "";
            }
        }
    }

    public static Task_image_item_model create(){
        Task_image_item_model model = new Task_image_item_model();
        model.id = "451fb8627391a962c267eb3a345e98fe";
        model.iconType = 1;
        model.totalCount = 100;
        model.doneCoount = 0;
        model.title = "钱叮叮";
        model.icon = "https://img.icons8.com/ios-filled/2x/ok-message.png";
        model.money = 300;

        return model;
    }

    public static Task_image_item_model getModelByJSONObject(JSONObject object){
        Task_image_item_model model = new Task_image_item_model();
        model.id = CJJsonUtils.getValueFromKey_string(object,"tid");
        model.iconType = CJJsonUtils.getValueFromKey_int(object,"task_type");
        model.doneCoount = CJJsonUtils.getValueFromKey_int(object,"cost_num");
        model.money = CJJsonUtils.getValueFromKey_float(object,"reward");
        model.title = CJJsonUtils.getValueFromKey_string(object,"task_title");
        model.totalCount = CJJsonUtils.getValueFromKey_int(object,"total_num");
        model.ut_status = CJJsonUtils.getValueFromKey_int(object,"ut_status");
        return model;
    }
}
